'\" te
.\" Copyright (C) 1999, Sun Microsystems,
.\" Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ICMP6 4P "Dec 03, 2015"
.SH NAME
icmp6 \- Internet Control Message Protocol for Internet Protocol Version 6
.SH SYNOPSIS
.LP
.nf
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip_icmp.h>
#include <netinet/icmp6.h>
.fi

.LP
.nf
s = socket(AF_INET6, SOCK_RAW, proto);
.fi

.LP
.nf
t = t_open("/dev/icmp6", O_RDWR);
.fi

.SH DESCRIPTION
.LP
The \fBICMP6\fR protocol is the error and control message protocol used with
Version 6 of the Internet Protocol. It is used by the kernel to handle and
report errors in protocol processing. It is also used for \fBIPv6\fR neighbor
and router discovery, and for multicast group membership queries and reports.
It may also be accessed by programs using the socket interface or the Transport
Level Interface (\fBTLI\fR) for network monitoring and diagnostic functions.
When used with the socket interface, a "raw socket" type is used. The protocol
number for \fBICMP6\fR, used in the \fIproto\fR parameter to the socket call,
can be obtained from \fBgetprotobyname\fR(3SOCKET). \fBICMP6\fR file
descriptors and sockets are connectionless and are normally used with the
\fBt_sndudata\fR / \fBt_rcvudata\fR and the \fBsendto()\fR / \fBrecvfrom()\fR
calls. They may also be used with the \fBsendmsg()\fR/\fBrecvgmsg()\fR calls
when sending or receiving ancillary data. In order to send \fBICMP6\fR packets,
a process needs the \fBPRIV_NET_ICMPACCESS\fR privilege. (See
\fBprivileges\fR(7) for more information on privileges.)
.sp
.LP
Outgoing packets automatically have an Internet Protocol Version 6 (\fBIPv6\fR)
header and zero or more \fBIPv6\fR extension headers prepended. These headers
are prepended by the kernel. Unlike \fBICMP\fR for \fBIPv4\fR, the
\fBIP_HDRINCL\fR option is not supported for \fBICMP6\fR, so \fBICMP6\fR
applications neither build their own outbound \fBIPv6\fR headers, nor do they
receive the inbound \fBIPv6\fR headers with received data. \fBIPv6\fR extension
headers and relevant fields of the \fBIPv6\fR header may be set or received as
ancillary data to a \fBsendmsg\fR(3SOCKET) or \fBrecvmsg\fR(3SOCKET) system
call. Each of these fields and extension headers may also be set on a per
socket basis with the \fBsetsockopt\fR(3SOCKET) system call. Such "sticky"
options are used on all outgoing packets unless overridden by ancillary data.
When any ancillary data is present with a \fBsendmsg\fR(3SOCKET) system call,
all sticky options are ignored for that system call, but subsequently remain
configured.
.sp
.LP
\fBICMP6\fR is a datagram protocol layered above \fBIPv6\fR. Received
\fBICMP6\fR messages may be reflected back to users of higher-level protocols
such as \fBTCP\fR or \fBUDP\fR as error returns from system calls. A copy of
each \fBICMP6\fR error message received by the system is provided to every
holder of an open \fBICMP6\fR socket or \fBTLI\fR descriptor.
.SH SEE ALSO
.LP
.BR t_rcvudata (3NSL),
.BR t_sndudata (3NSL),
.BR getprotobyname (3SOCKET),
.BR recv (3SOCKET),
.BR recvmsg (3SOCKET),
.BR send (3SOCKET),
.BR sendmsg (3SOCKET),
.BR setsockopt (3SOCKET),
.BR inet6 (4P),
.BR ip6 (4P),
.BR routing (4P),
.BR privileges (7)
.sp
.LP
Conta, A. and Deering, S., \fIRFC 2463, Internet Control Message Protocol
(ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification\fR, The
Internet Society, December 1998.
.SH DIAGNOSTICS
.LP
A socket operation may fail with one of the following errors returned:
.sp
.ne 2
.na
\fB\fBEISCONN\fR\fR
.ad
.RS 17n
An attempt was made to establish a connection on a socket which already has
one, or when trying to send a datagram with the destination address specified
and the socket is already connected.
.RE

.sp
.ne 2
.na
\fB\fBENOTCONN\fR\fR
.ad
.RS 17n
An attempt was made to send a datagram, but no destination address is
specified, and the socket has not been connected.
.RE

.sp
.ne 2
.na
\fB\fBENOBUFS\fR\fR
.ad
.RS 17n
The system ran out of memory for an internal data structure.
.RE

.sp
.ne 2
.na
\fB\fBEADDRNOTAVAIL\fR\fR
.ad
.RS 17n
An attempt was made to create a socket with a network address for which no
network interface exists.
.RE

.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 17n
The system was unable to allocate memory for an internal data structure.
.RE

.sp
.ne 2
.na
\fB\fBENOPROTOOPT\fR\fR
.ad
.RS 17n
An attempt was made to set an \fBIPv4\fR socket option on an \fBIPv6\fR socket.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 17n
An attempt was made to set an invalid or malformed socket option.
.RE

.sp
.ne 2
.na
\fB\fBEAFNOSUPPORT\fR\fR
.ad
.RS 17n
An attempt was made to bind or connect to an \fBIPv4\fR or mapped address, or
to specify an \fBIPv4\fR or mapped address as the next hop.
.RE

